home *** CD-ROM | disk | FTP | other *** search
- Path: BIX.com!magma
- From: magma@BIX.com (magma on BIX)
- Newsgroups: comp.lang.c++
- Subject: Re: Help with Cedit view !
- Date: 16 Jan 96 11:48:06 GMT
- Organization: Delphi Internet Services Corporation
- Message-ID: <magma.821792886@BIX.com>
- References: <4de4af$s71@server-b.cs.interbusiness.it>
- NNTP-Posting-Host: bix.com
-
- Softec@system.abacom.it (Softec@system.abacom.it) writes:
-
- >I'm developing an editor using the Microsoft Visual C++ and the MFC.
- >My editor has the following features:
- > 1. Show the content of a ASCII file.
- > 2. Change the text color and the background color of a line when a particular
- >condition occours (same as when I set a breakpoint in the Visual C++ editor)
-
- >I tried to derivated the CEditView class and I loaded the file using the following code:
-
- > CEdit& edit = GetEditCtrl(); // get a reference to the CEdit control
- > CFile f; // used by the edit view
-
- > if(!f.Open(filename, CFile::modeRead | CFile::typeBinary))
- > {
- > AfxMessageBox("File no found");
- > return 0;
- > }
- > DWORD len = f.GetLength();
- > HLOCAL hBuff = LocalAlloc(LMEM_MOVEABLE,len+1);
- > LPSTR = (LPSTR)LocalLock(hBuff);
- > f.Read(pbuff,len);
- > f.Close();
- > pbuff[len]=NULL;
- > edit.SetWindowText(pbuff);
- > edit.SetReadOnly(TRUE); // Read only
- > LocalUnlock(hBuff);
- > LocalFree(hBuff);
- > return 0;
-
-
- >But now I don't know how to change the color of a line.
- >Where is somebody that can help me ?
-
- >Thank you in advance
- > Piero Poletto
-
-
- Hello,
-
- What you are trying to do with a CEditView is not very easy, especially
- since the CEditView class uses the standard Windows edit control, and
- therefore, has no provisions for coloring individual chunks of text.
- There are several things you can do :
-
- 1) Write your own edit control.
-
- 2) Use the new Microsoft Win95 RICHED control.
-
- 3) Use a third party edit control like the Magma Editor. I have
- enclosed a "canned" reply which is sent to people who need features
- like syntax highlighting, etc. By the way, the Magma Editor DLl has been
- used to provide the edit buffer for debuggers.
-
- Regards,
-
- Marc Adler
-
- -------------------
-
- Hello,
-
- In your posting, you mentioned that you were looking for a Windows
- editing DLL which could do syntax highlighting.
-
- The MAGMA Editor DLL/VBX for Win16/Win32 can help you out.
- It has an ownerdrawn-line style, much like Windows' ownerdrawn listboxes
- and menus. When you give the edit control the ES_OWNERDRAW style, your
- application is sent notification messages when each line needs to be
- drawn. You can draw the line yourself, or you can let the editor
- itself draw the line.
-
- Using ownerdrawn lines, many developers who use the Magma Editor DLL
- have implemented syntax highlighting within their apps. In fact, the
- MEWIN programmer's editor sample which comes with the Magma Editor
- has code to do some simple "C"-language syntax highlighting.
-
- The Magma Editor DLL has a lot of other features which make it very
- useful for building IDEs or custom language editors. You can think of
- it as a 'BRIEF-in-a-DLL'.
-
- You can use the editor with any language or environment which supports
- loading DLLs. We also have drop-in replacement classes for MFC, zApp,
- OWL, VB, and PASCAL.
-
- For more info, you can visit the WWW page http://www.uno.com.
- You can download a fully functional 'lite' version from the WWW page or
- you can FTP it from ftp.uu.net, directory /vendor/uno. Look for MAGMAED.ZIP.
- There are also files for the drop-in replacement classes.
-
- Regards,
-
- Marc Adler
- Magma Systems
-
-
-